from .robject import robject
class comment(robject):
	def __init__(self, json):
		robject.__init__(self, json)
		self.parseComment(json)

	def parseComment(self, json):
			self.subreddit_id = json["data"]["subreddit_id"]
			self.banned_by = json["data"]["banned_by"]
			self.subreddit = json["data"]["subreddit"]
			self.likes = json["data"]["likes"]
			self.replies = []
			self.hiddenreplies = []
			if "data" in json["data"]["replies"]:
				for item in json["data"]["replies"]["data"]["children"]:
					if item["kind"] == "Listing" or item["kind"] == "t1":
						self.replies.append(comment(item))
					elif item["kind"] == "more":
						self.hiddenreplies += [x for x in item["data"]["children"]]
			self.id = json["data"]["id"]
			self.gilded = json["data"]["gilded"]
			self.author = json["data"]["author"]
			self.parent_id = json["data"]["parent_id"]
			self.approved_by = json["data"]["approved_by"]
			self.body = json["data"]["body"]
			self.edited = json["data"]["edited"]
			self.author_flair_css_class = json["data"]["author_flair_css_class"]
			self.downs = json["data"]["downs"]
			self.body_html = json["data"]["body_html"]
			self.link_id = json["data"]["link_id"]
			self.score_hidden = json["data"]["score_hidden"]
			self.name = json["data"]["name"]
			self.created = json["data"]["created"]
			self.author_flair_text = json["data"]["author_flair_text"]
			self.created_utc = json["data"]["created_utc"]
			self.distinguished = json["data"]["distinguished"]
			self.num_reports = json["data"]["num_reports"]
			self.ups = json["data"]["ups"]